/**
 * 
 */

package tag.usebean.basic;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.e885.log.E885Logger;
import common.CommonHttpServlet;
import common.LoginBean;

/**
 * url:http://127.0.0.1:8080/JSP/tag/usebean/basic/basicLogin.jsp<br>
 * 由頁面輸入 account 和 password, 並導到　basicSuccess.jsp, 使用　<jsp:useBean> tag 來顯示資料<br>
 * 
 * @author Eric.Kao(gau168.gau@msa.hinet.net)
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2001-2008
 */

public class BasicLoginServlet extends CommonHttpServlet
{
	private static final long serialVersionUID = -4304174243042234554L;

	protected void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
	{
		String account = request.getParameter( "account" );
		String password = request.getParameter( "password" );

		E885Logger.servletLog.debug( "name:[" + account + "]" );
		E885Logger.servletLog.debug( "password:[" + password + "]" );

		LoginBean bean = new LoginBean();
		bean.setAccount( account );
		bean.setPassword( password );

		request.setAttribute( "loginBean", bean );

		request.getRequestDispatcher( "/tag/usebean/basic/basicSuccess.jsp" ).forward( request, response );
	}
}
